package com.phone.dao.impl;

import java.util.List;

import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.phone.dao.AdminDao;
import com.phone.entity.Admin;
import com.phone.entity.Product;
import com.phone.entity.Store;
import com.phone.entity.User;

@Repository
public class AdminDaoimpl implements AdminDao {
    @Autowired
    private SessionFactory sessionFactory;

	@Override
	public List<Store> allstore() {
		String hql="from Store";
		Query query=this.sessionFactory.getCurrentSession().createQuery(hql);
		List<Store> allstore=query.list();
		return allstore;
	}

	@Override
	public List<User> alluser() {
		String hql="from User";
		Query query=this.sessionFactory.getCurrentSession().createQuery(hql);
		List<User> alluser=query.list();
		return alluser;
	}

	@Override
	public boolean upadmin(Admin admin) {
		this.sessionFactory.getCurrentSession().update(admin);
		return true;
	}
	

}
